<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui">

<h:head><h1>Modifica Pacchetto</h1>
	  <style type="text/css">
        .ui-layout-unit{
             border: none;
        }
    </style>
							<link type="text/css" href="../generalstyle.css" rel="stylesheet"/>


</h:head>
<body>
	<img src="http://www.icsbellano.org/spazioalunni/cacce/immagini/scatolone.gif" alt="" height="200" width="300" />
	<h:form>
        <p:menubar>  
                <p:menuitem value="Home" url="../home.xhtml" />  
				<p:menuitem value="Area Cliente" url="../cliente/homeCliente.xhtml" />
				<p:menuitem value="Area Impiegato" url="../impiegato/homeImpiegato.xhtml" /> 
				<p:menuitem value="Login" url="../login.xhtml" rendered="#{request.remoteUser == null}" />
                <p:menuitem value="Logout" actionListener="#{logoutManagedBean.logout()}" rendered="#{request.remoteUser != null}" />
		</p:menubar>
		</h:form>
		<br></br>
	<h:form>
  <p:panel header="Modifica Pacchetto"  style="width:600px; margin:0 auto; text-align:center;">
			<h:panelGrid columns="3" id="regGrid">
	
					<p:outputLabel for="nome" value="Nome Pacchetto"/>
				    <p:inputText id="nome" value="#{ModPacchettoManagedBean.pacchettoCorrente.nome}" requiredMessage="Campo obbligatorio" required="true" />
					<p:message for="nome" />
					
					<p:outputLabel for="numeroPersone" value="Numero Persone" />
					<p:inputText id="numeroPersone" value="#{ModPacchettoManagedBean.pacchettoCorrente.numeroPersone}" requiredMessage="Campo obbligatorio" required="true">
					<f:validateLongRange minimum="1" />
					</p:inputText>
					<p:message for="numeroPersone" />
					
					
			</h:panelGrid>

			<p:commandButton value="MODIFICA" update="regGrid" action="#{ModPacchettoManagedBean.updatePacchetto()}" />
			<p:commandButton value="VISUALIZZA TUTTO" update="regGrid" actionListener="#{ModPacchettoManagedBean.visualizzaPacchetto()}" ajax="false" />
			<p:button outcome="./aggiungiAPacchetto.xhtml?id=#{ModPacchettoManagedBean.pacchettoCorrente.idPacchetto}&amp;crea=false" value="AGGIUNGI" />

		</p:panel>


    </h:form>
    
    
  <hr></hr>
    
    <ui:repeat value="#{ModPacchettoManagedBean.hotels}" var="hotelCorr" varStatus="statoHotel">
        <h:form>
         <p:layout style=" height:150px;">
				<p:layoutUnit position="center">
				
					<p:layout style="height:50px;" >
						<p:layoutUnit position="west" size="200">
							<p:outputLabel value="Nome Hotel: " />
							<p></p>
							<p:outputLabel value="Indirizzo Hotel: " />
							<p></p>
							<p:outputLabel value="Stato: " />
							
						</p:layoutUnit>
						
						<p:layoutUnit position="center">
							 <p:outputLabel id="hNome" value="#{hotelCorr.nome}"/>
							 <p></p>
          					<p:outputLabel id="hIndirizzo" value="#{hotelCorr.indirizzo}" />
          					<p></p>
          					<p:outputLabel id="hScelto" value="#{ModPacchettoManagedBean.compHotel.get(statoHotel.index).getScelto()}" />
						</p:layoutUnit>
					</p:layout>
					
				</p:layoutUnit>
				<p:layoutUnit position="east" size="600">
						<p:commandButton
						actionListener="#{ModPacchettoManagedBean.rimuoviHotel(ModPacchettoManagedBean.hotels.get(statoHotel.index).id)}"
						value="RIMUOVI" ajax="false" />
				</p:layoutUnit>
		</p:layout>
        </h:form>            
    </ui:repeat>
    
<hr></hr>
   

    <ui:repeat value="#{ModPacchettoManagedBean.voli}" var="voloCorr" varStatus="statoVolo">
        <h:form>
         <p:layout style=" height:150px;">
				<p:layoutUnit position="center">
				
					<p:layout style="height:50px;" >
						<p:layoutUnit position="west" size="200">
							<p:outputLabel value="Volo Partenza: " />
							<p></p>
							<p:outputLabel value="Volo Destinazione: " />
							<p></p>
							<p:outputLabel value="Stato: " />
							
						</p:layoutUnit>
						
						<p:layoutUnit position="center">
							<p:outputLabel id="luogoPart" value="#{voloCorr.luogoPartenza}" />
							<p></p>
           					 <p:outputLabel id="luogoDest" value="#{voloCorr.luogoDestinazione}" />
           					 <p></p>
          					<p:outputLabel id="vScelto" value="#{ModPacchettoManagedBean.compVolo.get(statoVolo.index).getScelto()}" />
						</p:layoutUnit>
					</p:layout>
					
				</p:layoutUnit>
				<p:layoutUnit position="east" size="600">
						<p:commandButton
						actionListener="#{ModPacchettoManagedBean.rimuoviVolo(ModPacchettoManagedBean.voli.get(statoVolo.index).id)}"
						value="RIMUOVI" ajax="false" />
				</p:layoutUnit>
			</p:layout>
        </h:form>
    </ui:repeat>
    


<hr></hr>


    <ui:repeat value="#{ModPacchettoManagedBean.escursioni}" var="escCorr" varStatus="statoEsc">
        <h:form>
             <p:layout style=" height:150px;">
				<p:layoutUnit position="center">
				
					<p:layout style="height:50px;" >
						<p:layoutUnit position="west" size="200">
							<p:outputLabel value="Indirizzo Escursione: " />
							<p></p>
							<p:outputLabel value="Posti Escursione: " />
							<p></p>
							<p:outputLabel value="Stato: " />
							
						</p:layoutUnit>
						
						<p:layoutUnit position="center">
						  <p:outputLabel  id="indirizzo" value="#{escCorr.indirizzo}" />
							<p></p>
					      <p:outputLabel id="numeroPosti" value="#{escCorr.numeroPosti}" />
					      <p></p>
          					<p:outputLabel id="eScelto" value="#{ModPacchettoManagedBean.compEsc.get(statoEsc.index).getScelto()}" />
						</p:layoutUnit>
					</p:layout>
					
				</p:layoutUnit>
				<p:layoutUnit position="east" size="600">
						<p:commandButton
						actionListener="#{ModPacchettoManagedBean.rimuoviEscursione(ModPacchettoManagedBean.escursioni.get(statoEsc.index).id)}"
						value="RIMUOVI" ajax="false" />
				</p:layoutUnit>
			</p:layout>
        </h:form>
    </ui:repeat>
    
    
         
    
    
</body>
</html>